using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerAirState : PlayerState
{
    public PlayerAirState(Player _player, PlayerStateMachine _playerStateMachine, string _animBoolName) : base(_player, _playerStateMachine, _animBoolName)
    {
    }

    public override void Enter()
    {
        base.Enter();
    }


    public override void Update()
    {
        base.Update();

        //�������ж�
        if (Input.GetKeyDown(KeyCode.Space) && player.currentJumpCount < player.maxJumpCount)
           player.stateMachine.ChangeState(player.jumpState);

        //�Ӵ�����ʱת������״̬
        if (player.IsGroundDetected())
            player.stateMachine.ChangeState(player.idleState);

        //�����ƶ�ʱ���ƶ���������
        if (xInput != 0)
            player.SetVelocity(xInput * player.moveSpeed * .8f, rb.velocity.y);
    }
    public override void Exit()
    {
        base.Exit();
    }
}
